package zdy.web.servlet;

import java.io.IOException;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class HelloWorld
 */
@WebServlet("/s/hello1")
//扩展 HttpServlet 类
public class HelloWorld extends HttpServlet {

private String message;

public void init() throws ServletException
{	   // 执行必需的初始化
	   message = "Hello World";
}
public String toString() {
	return "HelloWorld xh";
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
   // 设置响应内容类型
	myfun();
   response.setContentType("text/html");
   // 实际的逻辑是在这里
   java.io.PrintWriter out = response.getWriter();
   out.println("<h1>" + message + "</h1>");
}

public void myfun() {}
public void destroy()
{
   // 什么也不做
}
}
